home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Effect library / Demo ƒ / Reversed fades ƒ / Full scroll left fade.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-11  |  2.0 KB  |  64 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Full scroll left fade.c
  4.  
  5. Purpose:    Graphic effect to fade main window to solid pattern.
  6.             See comments below for more description.
  7.  
  8.  
  9. MSG Demo -- graphic effects demonstration program
  10. Copyright (C) 1992-4 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define CorrectTime 3
  32. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  33. #define theWindowWidth (boundsRect.right-boundsRect.left)
  34.  
  35. pascal short FullScrollLeftFade(Rect boundsRect, Pattern *thePattern);
  36.  
  37. /* Take the whole screen minus the lefthand strip; move it into the whole screen
  38.    shifted left by BoxSize; take the lefthand strip of the source window and
  39.    move it into the right strip of the dest.  */
  40.    
  41. pascal short FullScrollLeftFade(Rect boundsRect, Pattern *thePattern)
  42. {
  43.     int                x, y;
  44.     Rect            dest;
  45.     int                BoxSize;
  46.     
  47.     BoxSize=theWindowWidth/25;
  48.     
  49.     dest = boundsRect;
  50.     dest.left=dest.right-BoxSize;                /* righthand strip */
  51.     
  52.     for(x = theWindowWidth - BoxSize; x >= 0; x -= BoxSize)
  53.     {
  54.         StartTiming();
  55.         ScrollRect(&boundsRect, -BoxSize, 0, 0L);
  56.         FillRect(&dest, *thePattern);
  57.         TimeCorrection(CorrectTime);
  58.     }
  59.     
  60.     FillRect(&boundsRect, *thePattern);
  61.  
  62.     return 0;
  63. }
  64.